package com.cxb.apiBoss.controller;

import com.cxb.apiBoss.service.CarService;
import com.cxb.apiBoss.service.DriverUserService;
import com.cxb.internalcommon.dto.Car;
import com.cxb.internalcommon.dto.DriverCarBindingRelationship;
import com.cxb.internalcommon.dto.DriverUser;
import com.cxb.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 司机和车辆信息的添加
 * 司机信息的修改
 */

@RestController
public class DriverUserController {

    @Autowired
    private DriverUserService driverUserService;

    @Autowired
    private CarService carService;
    /**
     * 添加司机信息
     * @param driverUser
     * @return
     */
    @PostMapping("/driver-user")
    public ResponseResult addDriverUser(@RequestBody DriverUser driverUser){

        return  driverUserService.addDriverUser(driverUser);
    }

    /**
     * 修改司机信息
     * @param driverUser
     * @return
     */
    @PutMapping("/driver-user")
    public ResponseResult updateDriverUser(@RequestBody DriverUser driverUser){
        return driverUserService.updateDriverUser(driverUser);
    }

    /**
     * 添加车辆信息
     * @param car
     * @return
     */
    @PostMapping("/car")
    public ResponseResult addCar(@RequestBody Car car){
        return carService.addCar(car);
    }



}
